#!/system/bin/sh
# 等待系统启动完成，特别是包管理器（pm）准备就绪
while [ "$(getprop sys.boot_completed)" != "1" ]; do
    sleep 1
done

# 额外再等待一段时间，确保万无一失
sleep 5

# 使用 pm grant 命令授予权限
# 格式： pm grant <package-name> <permission>
pm grant com.jinyi.wwdeng.autodialer android.permission.READ_EXTERNAL_STORAGE
pm grant com.jinyi.wwdeng.autodialer android.permission.WRITE_EXTERNAL_STORAGE
pm grant com.jinyi.wwdeng.autodialer android.permission.READ_PHONE_STATE
pm grant com.jinyi.wwdeng.autodialer android.permission.RECORD_AUDIO
pm grant com.jinyi.wwdeng.autodialer android.permission.CALL_PHONE
pm grant com.jinyi.wwdeng.autodialer android.permission.POST_NOTIFICATIONS
pm grant com.jinyi.wwdeng.autodialer android.permission.READ_CALL_LOG
